package game.feign.fallback;

import common.config.feign.FallbackFactoryUtil;
import common.model.request.SendEmailRequest;
import common.model.response.base.Result;
import feign.hystrix.FallbackFactory;
import game.feign.SystemFeign;
import org.springframework.stereotype.Component;

/**
 * @author 米泽鹏
 * @since 2022-3-31 下午 10:29
 */
@Component
public class SystemFeignFallbackFactory implements FallbackFactory<SystemFeign> {

	@Override
	public SystemFeign create(Throwable throwable) {
		return FallbackFactoryUtil.create(throwable, new SystemFeign() {
			@Override
			public Result<?> sendEmail(SendEmailRequest request) {
				return Result.error(throwable);
			}
		});
	}

}
